package cn.minsh.lims.eoms.modules.app.utils;

import cn.minsh.lims.eoms.common.utils.R;

import java.util.Random;

/**
 * @author Administrator
 */
public class CodeUtils {

    public static String[] IDX_ARRAY = {"I","M","R"} ;
    public static String CONSTANT = "0123456789" ;

    public static String getCode(String start,Integer len){
        String end = System.currentTimeMillis()+"" ;
        if (end.length()>=len){
            end = end.substring(end.length()-len,end.length()) ;
        }else{
            StringBuffer stringBuffer = new StringBuffer( );
            Random random = new Random() ;
            for (int i=0;i<len-end.length();i++){
                stringBuffer.append(CONSTANT.charAt(random.nextInt(10))) ;
            }
            end += stringBuffer.toString() ;
        }
        return start+end ;
    }

    public static void main(String[] args) {
        System.out.println(getCode(IDX_ARRAY[0],2));
    }

}
